package com.tdkj.service.user.impl;

import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Component;

import com.tdkj.dao.admin.IBeanAdminLevelDao;
import com.tdkj.model.base.BaseEntity;
import com.tdkj.model.user.BeanPermission;
import com.tdkj.service.BaseService;
import com.tdkj.service.user.IBeanAdminLevelService;
import com.tdkj.util.CopyUtils;

@Component("adminLevelService")
public class BeanAdminLevelServiceImpl extends BaseService  implements IBeanAdminLevelService{
	private  IBeanAdminLevelDao beanAdminLevelDao;
	         
	@Resource
	public void setBeanAdminLevelDao(IBeanAdminLevelDao beanAdminLevelDao) {
		this.beanAdminLevelDao = beanAdminLevelDao;
	}

	@Override
	public void saveOrUpdate(BeanPermission beanPermission) {
		if(StringUtils.isNotEmpty(beanPermission.getId()+"")){
			BeanPermission old=this.beanAdminLevelDao.findById(beanPermission.getId(), BeanPermission.class);
			CopyUtils.copyNotNullProperties(old, beanPermission);
			beanPermission=old;
		}
		beanAdminLevelDao.save(beanPermission);
		
	}

	@Override
	public <T extends BaseEntity> List<T> findAll(Class<T> clazz, LinkedHashMap<String, String> orderInfos) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T extends BaseEntity> List<T> findByExample(T t, LinkedHashMap<String, String> orderInfos) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T extends BaseEntity> List<T> findByProperty(String propertyName, Object value, Class<T> clazz, LinkedHashMap<String, String> orderInfos) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
